<template>
  <el-row>
    <WellData
      :list="data1"
      :firstTitleSpan="6"
      :secondTitleSpan="12"
      :dataSpan="12"
    />
    <div class="optinos">
      <el-button type="danger" style="margin: 5px 0px" @click="goback()">
        返回
      </el-button>
      <br />
      <el-button @click="goTop" type="info"> 顶部 </el-button>
    </div>
  </el-row>
</template>

<script>
import WellData from '../dataQuery/wellQuery/comprehensiveDataSheet/index'
import {
  getGeneralDataReport,
  getWellCasingSize,
} from '../../api/module/dataquery.js'

export default {
  components: {
    WellData,
  },
  data() {
    return {
      form: {},
      pager: {},
      data1: [{}],
      loading: false,
      wellName: '',
      casingSize: '',
      queryList: [],
    }
  },
  created() {
    this.getRouterData()
  },
  mounted() {
    this.handleGetGeneralDataReport()
  },
  methods: {
    getRouterData() {
      this.form = this.$route.params.filterForm
      this.pager = this.$route.params.pager
      this.queryList.push({
        wellName: this.$route.params.id,
        casingSize: this.$route.params.casingSize,
      })
      this.data1[0] = {
        basic: {
          wellName: this.$route.params.id,
          caseSize: this.$route.params.casingSize,
        },
      }
    },
    goback() {
      // this.$router.push({
      //   name: 'dataValidate',
      //   params: { filterForm: this.form, pager: this.pager },
      // })
      this.$router.go(-1)
    },
    handleGetGeneralDataReport() {
      this.loading = true
      getGeneralDataReport(this.queryList)
        .then((res) => {
          this.data1 = res.data.data || this.data1
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.loading = false
        })
    },
    goTop(){
      document.querySelector("#CM_WK_BASIC").scrollIntoView(true)
    }
  },
}
</script>

<style scoped>
.optinos {
  position: fixed;
  bottom: 10%;
  right: 0px;
}
</style>
